
import java.util.zip.*;
import java.nio.ByteBuffer;

//designed for testing methods out

public class ScratchPaper
{
	public static void main (String [] args) throws InstantiationException
	{

		ByteBuffer z = ByteBuffer.allocate(72);
		byte [] test = new byte [72];

		// Populate the test ethernet frame.
		// Preamble.
		for (int i = 0; i < 7; i++)
		{
			test[i] = 42;
		}

		// Start of frame.
		test[7] = 43;

		// Destination address.
		for (int i = 8; i < 14; i++)
		{
			test[i] = 15;
		}

		// Source address.
		for (int i = 14; i < 20; i++)
		{
			test[i] = 20;
		}

		// Type / length.
		test[20] = -128;
		test[21] = -128;

		// Payload / data.
		for (int i = 22; i < 68; i++)
		{
			test[i] = -101;
		}

		// CRC.
		test[68] = -128;
		test[69] = -128;
		test[70] = -128;
		test[71] = -113;


		z.put(test);

		EthernetFrame eframe = new EthernetFrame(z.array());

		
		System.out.print(eframe.toString());


		long CRCvalue;
		CRC32 x = new CRC32();
		x.update (test);
		CRCvalue = x.getValue();
		//System.out.println (CRCvalue);
		//        z.putLong (CRCvalue);
		/*byte num = 1;
        for (int y = 0; y < 8; y ++)
        {
            System.out.println (num);
            num >>= 1;
        }*/
		//        byte [] something = new byte [9];
		//        something = z.array();
		//        for (int a = 0; a < something.length; a ++)
		//        {
		//            System.out.println (something [a]);
		//        }
		//        System.out.println (x.getValue());
		//        x.reset();
		//        x.update(something);
		//        System.out.println (x.getValue());
	}
}
